/**
 * 
 */
package com.dalonedrau.jogl.opengl.ui;

import java.awt.geom.Rectangle2D;

import com.dalonedrau.jogl.engine.Action;
import com.dalonedrau.jogl.opengl.ui.border.GuiBorder;

/**
 * @author Donald
 */
public interface GuiSelectable extends GuiComponent {
	/**
	 * Adds an action to perform.
	 * @param action the {@link Action}
	 */
	void addAction(final Action action);
	/**
	 * Removes all {@link Action}s associated with the {@link GuiSelectable}.
	 */
	void clearActions();
	/**
	 * Gets the {@link GuiSelectable}'s hotspot.
	 * @return {@link Rectangle2D.Double}
	 */
	Rectangle2D.Double getHotSpot();
	/**
	 * Determines if a {@link GuiSelectable} is highlightable or not.
	 * @return true if the {@link GuiSelectable} can be highlighted; false
	 *         otherwise
	 */
	boolean isHighlightable();
	/**
	 * Determines if a {@link GuiSelectable} is highlighted or not.
	 * @return true if the {@link GuiSelectable} is highlighted; false otherwise
	 */
	boolean isHighlighted();
	/**
	 * Test to see if the specified position is within the HotSpot.
	 * @param x the x-position of the user's focus
	 * @param y the x-position of the user's focus
	 * @return true if the specified position is within the hotspot; false
	 *         otherwise
	 */
	boolean isInHotSpot(final float x, final float y);
	/**
	 * Determines if a {@link GuiSelectable} is selectable or not.
	 * @return true if the {@link GuiSelectable} can be selected; false
	 *         otherwise
	 */
	boolean isSelectable();
	/**
	 * Determines if a {@link GuiSelectable} is selected or not.
	 * @return true if the {@link GuiSelectable} is selected; false otherwise
	 */
	boolean isSelected();
	/**
	 * Called when the item is highlighted and returns whether it is possible to
	 * highlight this item.
	 * @param highlighted flag indicating whether a highlight is being done
	 * @return true if the item can be highlighted; false otherwise
	 */
	boolean onHighlight(boolean highlighted);
	/**
	 * Called when the item is selected and returns whether it is possible to
	 * select this item.
	 * @return true if the item can be selected; false otherwise
	 */
	boolean onSelect();
	/**
	 * Performs the {@link Action}s associated with this {@link GuiSelectable}.
	 */
	void performAction();
	/** Removes the highlight. */
	void removeHighlight();
	/**
	 * Process what to do when the user's focus is in the specified position.
	 * @param x the x-position of the user's focus
	 * @param y the x-position of the user's focus
	 * @return true if the {@link GuiSelectable} can be focused
	 */
	boolean setFocus(final float x, final float y);
	/**
	 * Set whether the {@link GuiSelectable} is highlightable or not.
	 * @param isHighlightable if true, the {@link GuiSelectable} is
	 *            highlightable; otherwise it cannot be highlighted
	 */
	void setHighlightable(final boolean isHighlightable);
	/**
	 * Sets the image rendered when the item is highlighted.
	 * @param sprite the {@link GuiBorder} to set
	 */
	void setHighlightBorder(GuiBorder border);
	/**
	 * Sets the {@link GuiSelectable}'s hotspot.
	 * @param hotSpot the hotspot
	 */
	void setHotSpot(final Rectangle2D.Double hotSpot);
	/**
	 * Set whether the {@link GuiSelectable} is selectable or not.
	 * @param isSelectable if true, the {@link GuiSelectable} is selectable;
	 *            otherwise it cannot be selected
	 */
	void setSelectable(final boolean isSelectable);
	/**
	 * Sets the image rendered when the item is selected.
	 * @param sprite the {@link GuiBorder} to set
	 */
	void setSelectBorder(GuiBorder border);
}
